﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="items.aspx.cs" Inherits="items" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ListView ID="ListView1" runat="server" DataSourceID="LinqDataSource1" 
        onselectedindexchanged="ListView1_SelectedIndexChanged">
        <AlternatingItemTemplate> 
         <div style="" id="book2">
            <asp:Image ID="image_urlLabel" runat="server" ImageUrl='<%# Eval("image_url") %>' />           
            <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' CssClass="title" />
            <br />  
            Author:          
            <asp:Label ID="authorLabel" runat="server" Text='<%# Eval("author") %>' />    
            <br />        
            Price:
            <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' CssClass="price" />
            <br />
           <asp:Button ID="btnDetails" runat="server" Text="Details" CssClass="btnDetails" />
           <asp:Button ID="btnAddToCard" runat="server" Text="AddToCard" CssClass="btnAddToCard"/>
            <br />
            <br />
    </div>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <span style="">name:
            <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
            <br />
            author:
            <asp:TextBox ID="authorTextBox" runat="server" Text='<%# Bind("author") %>' />
            <br />
            price:
            <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
            <br />
            image_url:
            <asp:TextBox ID="image_urlTextBox" runat="server" 
                Text='<%# Bind("image_url") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
            <br /><br /></span>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <span>No data was returned.</span>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <div style=""  id="book">name:
            <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
            <br />author:
            <asp:TextBox ID="authorTextBox" runat="server" Text='<%# Bind("author") %>' />
            <br />price:
            <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
            <br />image_url:
            <asp:TextBox ID="image_urlTextBox" runat="server" 
                Text='<%# Bind("image_url") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br /><br /></div>
        </InsertItemTemplate>
        <ItemTemplate>
            <div style="" id="book1">
                <asp:Image ID="image_urlLabel" runat="server" ImageUrl='<%# Eval("image_url") %>' />                       
                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' CssClass="title"/>
                <br />
                Author:
                <asp:Label ID="authorLabel" runat="server" Text='<%# Eval("author") %>' />
                <br />
                price:
                <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' CssClass="price"  />
                <br />                  
                <asp:Button ID="btnDetails" runat="server" Text="Details" CssClass="btnDetails" /> 
                <asp:Button ID="btnAddToCard" runat="server" Text="AddToCard" CssClass="btnAddToCard"/>
                
                <br />
                <br />
            </div>
        </ItemTemplate>
        <LayoutTemplate>
            <div ID="itemPlaceholderContainer" runat="server" style="">
                <span runat="server" id="itemPlaceholder" />
                
            </div>
            <div style="">
                <asp:DataPager ID="datapager" runat="server" PageSize="4">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Link" FirstPageText="First Page" ShowFirstPageButton="True" 
                            ShowNextPageButton="False" ShowPreviousPageButton="False" />
                        <asp:NumericPagerField />
                        <asp:NextPreviousPagerField ButtonType="Link" LastPageText="Last Page"  ShowLastPageButton="True" 
                            ShowNextPageButton="False" ShowPreviousPageButton="False" />
                    </Fields>
                </asp:DataPager>
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <span style="">name:
            <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
            <br />
            author:
            <asp:Label ID="authorLabel" runat="server" Text='<%# Eval("author") %>' />
            <br />
            price:
            <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
            <br />
            image_url:
            <asp:Label ID="image_urlLabel" runat="server" Text='<%# Eval("image_url") %>' />
            <br />
<br /></span>
        </SelectedItemTemplate>
    </asp:ListView>
    
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="BookStoreDataContext" EntityTypeName="" 
         TableName="items" Select="new (name, author, price, image_url)">
    </asp:LinqDataSource>
</asp:Content>

